home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / hal / scripts / linux / hal-system-killswitch-set-power-linux < prev    next >
Encoding:
Text File  |  2009-07-05  |  2.8 KB  |  96 lines

  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2007 Bastien Nocera <bnocera@redhat.com>
  4. # Copyright (C) 2007 David Zeuthen <davidz@redhat.com>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10.  
  11. if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
  12.     if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
  13.     hal-system-sonypic setbluetooth $value
  14.     ret=$?
  15.     if [ "$ret" != "0" ]; then
  16.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  17.         echo "hal-system-sonypic returned $ret" >&2
  18.         exit 1
  19.     fi
  20.     exit 0
  21.     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
  22.     if [ "$value" = "true" ]; then
  23.         hal-system-smbios --bt 1
  24.         ret=$?
  25.     else
  26.         hal-system-smbios --bt 0
  27.         ret=$?
  28.     fi
  29.     if [ "$ret" != "0" ]; then
  30.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  31.         echo "hal-system-smbios returned $ret" >&2
  32.         exit 1
  33.     fi
  34.     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -w "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
  35.         if [ "$value" = "true" ]; then 
  36.         bit=1; 
  37.     else 
  38.             bit=0; 
  39.         fi
  40.         echo $bit >$HAL_PROP_LINUX_SYSFS_PATH
  41.     ret=$?
  42.         if [ "$ret" != "0" ]; then
  43.             echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  44.         echo "cannot write $bit into $HAL_PROP_LINUX_SYSFS_PATH" >&2
  45.         exit 1
  46.     fi
  47.     else
  48.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  49.     echo "Access type not supported" >&2
  50.     exit 1
  51.     fi
  52. elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
  53.     if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
  54.     if [ "$value" = "true" ]; then
  55.         hal-system-smbios --wlan 1
  56.         ret=$?
  57.     else
  58.         hal-system-smbios --wlan 0
  59.         ret=$?
  60.     fi
  61.     if [ "$ret" != "0" ]; then
  62.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  63.         echo "$DELL_WCTL returned $ret" >&2
  64.             exit 1
  65.     fi
  66.     else
  67.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  68.     echo "Access type not supported" >&2
  69.     exit 1
  70.     fi
  71. elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
  72.     if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then 
  73.     if [ "$value" = "true" ]; then
  74.         hal-system-smbios --wwan 1
  75.         ret=$?
  76.     else
  77.         hal-system-smbios --wwan 0
  78.         ret=$?
  79.     fi
  80.     if [ "$ret" != "0" ]; then
  81.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  82.         echo "hal-system-smbios returned $ret" >&2
  83.             exit 1
  84.     fi
  85.     else
  86.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  87.     echo "Access type not supported" >&2
  88.     exit 1
  89.     fi
  90. else
  91.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  92.     echo "Killswitch type not supported" >&2
  93.     exit 1
  94. fi
  95.  
  96.